package 笔试.华为.线上笔试;

import java.util.Scanner;

// 35
public class 维修工最短路径 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int[][] points = new int[n][3];
        for (int i = 0; i < n; i++) {
            points[i][0] = sc.nextInt();
            points[i][1] = sc.nextInt();
            points[i][2] = sc.nextInt();
        }
        double sum = 0;
        for (int i = 0; i < n; i++) {
            int px = points[i][0];
            int py = points[i][1];
            int absx = Math.abs(px - x);
            int absy = Math.abs(py - y);
            double dis = 2 * Math.sqrt(absx * absx + absy * absy);
            sum += dis;
        }
        System.out.printf("%.1f", sum);
    }
}
